//////////////////////////////////////////////////////////////////////////////////
//	File Name:	SoundManager.h
//	Author	 :	Yuri Oyoko
//	Purpose	 :	Used for playing sounds and sound effects accross the game
//////////////////////////////////////////////////////////////////////////////////

#include "SoundManager.h"
#include "Definitions.h"
#include "SGD Wrappers/CSGD_WaveManager.h"

SoundManager::SoundManager()
{
}
SoundManager::~SoundManager()
{
}
SoundManager* SoundManager::GetInstance()
{
	static SoundManager theSoundManager;
	return &theSoundManager;
}
void SoundManager::Initialize()
{
	//Get current instance of the wave manager
	WaveManager = CSGD_WaveManager::GetInstance();

	//Load Sounds
	PistolFireSound = WaveManager->LoadWave(PistolShoot);
	PistolReloadSound = WaveManager->LoadWave(PistolReload);
	PistolEmptyClipSound = WaveManager->LoadWave(PistolEmpty);

	UziFireSound = WaveManager->LoadWave(UziShoot);
	UziReloadSound = WaveManager->LoadWave(UziReload);
	UziEmptyClipSound = WaveManager->LoadWave(UziEmpty);

	AssaultRifleFireSound = WaveManager->LoadWave(AssaultRifleShoot);
	AssaultRifleReloadSound = WaveManager->LoadWave(AssaultRifleReload);
	AssaultRifleEmptyClipSound = WaveManager->LoadWave(AssaultRifleEmpty);

	ShotgunFireSound = WaveManager->LoadWave(ShotgunShoot);
	ShotgunReloadSound = WaveManager->LoadWave(ShotgunReload);
	ShotgunPumpSound = WaveManager->LoadWave(ShotgunPump);

	AutoShotgunFireSound = WaveManager->LoadWave(AutoShotgunShoot);
	AutoShotgunReloadSound = WaveManager->LoadWave(AutoShotgunReload);
	AutoShotgunPumpSound = WaveManager->LoadWave(AutoShotgunPump);

	HuntingRifleFireSound = WaveManager->LoadWave(HuntingRifleShoot);
	HuntingRifleReloadSound = WaveManager->LoadWave(HuntingRifleReload);
	HuntingRifleEmptyClipSound = WaveManager->LoadWave(HuntingRifleEmpty);
}
void SoundManager::Shutdown()
{
	//Unload sounds
	WaveManager->UnloadWave(PistolFireSound);
	WaveManager->UnloadWave(PistolReloadSound);
	WaveManager->UnloadWave(PistolEmptyClipSound);

	WaveManager->UnloadWave(UziFireSound);
	WaveManager->UnloadWave(UziReloadSound);
	WaveManager->UnloadWave(UziEmptyClipSound);

	WaveManager->UnloadWave(AssaultRifleFireSound);
	WaveManager->UnloadWave(AssaultRifleReloadSound);
	WaveManager->UnloadWave(AssaultRifleEmptyClipSound);

	WaveManager->UnloadWave(ShotgunFireSound);
	WaveManager->UnloadWave(ShotgunReloadSound);
	WaveManager->UnloadWave(ShotgunPumpSound);

	WaveManager->UnloadWave(AutoShotgunFireSound);
	WaveManager->UnloadWave(AutoShotgunReloadSound);
	WaveManager->UnloadWave(AutoShotgunPumpSound);

	WaveManager->UnloadWave(HuntingRifleFireSound);
	WaveManager->UnloadWave(HuntingRifleReloadSound);
	WaveManager->UnloadWave(HuntingRifleEmptyClipSound);
}

void SoundManager::PlayASound(int SoundToPlay)
{
	WaveManager->Play(SoundToPlay,0);
}